import Controller.UserController;
import Dao.daoImpl.DBUtils;
import Model.login;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;
import java.util.Scanner;

public class Begin {
    public static void main(String[] args) throws SQLException {
        QueryRunner queryRunner = new QueryRunner();
        System.out.println("-----------房屋出租系统-------------");
        Scanner scanner = new Scanner(System.in);
        System.out.println("user");
        String user = scanner.next();
        System.out.println("password");
        String password = scanner.next();

        login login = queryRunner.query(DBUtils.getConnection(),
                "select * from login where user=? and password=?",
                new BeanHandler<login>(login.class),user,password);
        if (login==null){
            System.out.println("no");
        }else {
            UserController userController = new UserController();
            userController.UserServiceRequset();
        }
    }
}
